package com.ranjiaqi.homework;

import java.util.Random;

/**
 * @ClassName MyThread
 * @Description TODO
 * @Author hp
 * @Date 2021/6/28 21:02
 * @Version 1.0
 **/
public class MyThread extends Thread {

    private String WhoAmI ;
    private int delay;

    public MyThread(String whoAmI) {
        super(whoAmI);
        this.delay = new Random().nextInt(20);

    }
    public void run(){
        try {
            WhoAmI = Thread.currentThread().getName();
            Thread.sleep(delay);
            System.out.println(WhoAmI+"::"+delay);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }

    }
}
